import { type BrowserWindowConstructorOptions, app } from 'electron'
import createWindow from '../common/newWindow'
import services from './services'
import { generateWindowUuid } from '../../utils'

const openColorExtranction = async <T extends BrowserWindowConstructorOptions>(config?: T) => {
  const mainWindow = await createWindow('#/color-extranction', <T>{
    ...config,
    title: '取色',
    // fullscreen: true,
    alwaysOnTop: true,
    skipTaskbar: true,
    center: true,
    transparent: true
  })

  mainWindow.setAppDetails({
    appId: generateWindowUuid()
  })

  services({ mainWindow, app })
  // mainWindow.setAlwaysOnTop(true, 'screen-saver') // mac
  // mainWindow.setVisibleOnAllWorkspaces(true) // mac
  // mainWindow.setFullScreenable(false) // mac
}

export default openColorExtranction
